<!DOCTYPE html>
<html xmlns="http://www.w3c.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:p="http://primefaces.org/ui" xmlns:pt="http://xmlns.jcp.org/jsf/passthrough" xmlns:pe="http://primefaces.org/ui/extensions" xmlns:c="http://java.sun.com/jsp/jstl/core">

<ui:decorate id="msrpDecoration" template="/resources/template/template-crud.xhtml">

  <ui:param name="title" value="Leiturista" />

  <ui:param name="managedBean" value="#{leituristaBean}" />

  <ui:define name="botaoTopCadastro">

  </ui:define>

  <ui:define name="botaoTopExclusao">

  </ui:define>

  <ui:define name="parametroConsulta">

    <h:panelGrid columns="2" columnClasses="colunas">

      <h:outputLabel styleClass="fonte" value="Código" />
      <h:inputText value="#{leituristaBean.parametersSearch.codigo}" />

      <h:outputLabel styleClass="fonte" value="Nome" />
      <h:inputText value="#{leituristaBean.parametersSearch.nome}" styleClass="campoGrande" />

    </h:panelGrid>

  </ui:define>

  <ui:define name="tabelaDados">

    <p:column headerText="Código" width="6%" style="text-align: center">
      <h:outputText styleClass="fonte" value="#{beanEnt.codigo}" />
    </p:column>
    <p:column headerText="Nome" width="20%">
      <h:outputText styleClass="fonte" value="#{beanEnt.nome}" />
    </p:column>
    <p:column headerText="Endereço" width="20%">
      <h:outputText styleClass="fonte" value="#{beanEnt.endereco}" />
    </p:column>
    <p:column headerText="Número">
      <h:outputText styleClass="fonte" value="#{beanEnt.numero}" />
    </p:column>
    <p:column headerText="Telefone">
      <h:outputText styleClass="fonte" value="#{beanEnt.telefone}">
        <f:converter converterId="telefoneConverter" />
      </h:outputText>
    </p:column>
    <p:column headerText="Tipo">
      <h:outputText styleClass="fonte" value="#{beanEnt.enumTipoCadastrador.descricao}" />
    </p:column>
    <p:column headerText="Status">
      <h:outputText styleClass="fonte" value="#{beanEnt.status.descricao}" />
    </p:column>

  </ui:define>

  <ui:define name="formCadastro">

    <h:panelGrid columns="2" columnClasses="colunas">
      <h:outputLabel styleClass="fonte" value="Código" rendered="#{leituristaBean.state eq 'alterar'}" />
      <h:inputText value="#{leituristaBean.entity.codigo}" readonly="true" rendered="#{leituristaBean.state eq 'alterar'}" />

      <h:outputLabel styleClass="fonte" value="Nome" />
      <h:inputText value="#{leituristaBean.entity.nome}" required="true" requiredMessage="Nome é requerido." styleClass="campoGrande" />

      <h:outputLabel styleClass="fonte" value="Endereço" />
      <h:inputText value="#{leituristaBean.entity.endereco}" required="true" requiredMessage="Endereço é requerido." styleClass="campoGrande" />

      <h:outputLabel styleClass="fonte" value="Número" />
      <p:inputText value="#{leituristaBean.entity.numero}" required="true" requiredMessage="Número é requerido.">
        <pe:keyFilter mask="num" />
      </p:inputText>

      <h:outputLabel styleClass="fonte" value="Complemento" />
      <h:inputText value="#{leituristaBean.entity.complemento}" />

      <h:outputLabel styleClass="fonte" value="Telefone" />
      <h:inputText value="#{leituristaBean.entity.telefone}" maxlength="15" onkeypress="mascaraPhone9(this)" required="true" requiredMessage="Telefone é requerido.">
        <f:converter converterId="telefoneConverter" />
      </h:inputText>

      <h:outputLabel styleClass="fonte" value="Senha" />
      <h:inputSecret value="#{leituristaBean.entity.senha}" required="true" requiredMessage="Senha é requerido." />

      <h:outputLabel styleClass="fonte" value="Função" />
      <h:selectOneMenu value="#{leituristaBean.entity.enumTipoCadastrador}" required="true" requiredMessage="Função é requerido.">
        <f:selectItems var="_status" itemValue="#{_status}" itemLabel="#{_status.descricao}" value="#{leituristaBean.lstEnumTypeCadastrador}" />
      </h:selectOneMenu>

      <h:outputLabel styleClass="fonte" value="Leiturista SAAE" />
      <h:selectOneMenu value="#{leituristaBean.entity.leituristaSaae}" required="true" requiredMessage="Leiturista SAAE é requerido." converter="entityConverter">
        <f:selectItems var="_leiturista" itemValue="#{_leiturista}" itemLabel="#{_leiturista.nome}" value="#{leituristaBean.lstLeituristaSaae}" />
        <f:attribute name="itens" value="#{leituristaBean.lstLeituristaSaae}" />
      </h:selectOneMenu>

      <h:outputLabel styleClass="fonte" value="Status" rendered="#{leituristaBean.state eq 'alterar'}" />
      <h:selectOneMenu value="#{leituristaBean.entity.status}" rendered="#{leituristaBean.state eq 'alterar'}" required="true" requiredMessage="Status é requerido.">
        <f:selectItems var="_status" itemValue="#{_status}" itemLabel="#{_status.descricao}" value="#{leituristaBean.lstEnumStatus}" />
      </h:selectOneMenu>

    </h:panelGrid>

  </ui:define>

  <ui:define name="formExclusao">

  </ui:define>

</ui:decorate>

</html>